package com.tepth.busfix.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.tepth.busfix.bean.reponse.BusInfo;
import com.tepth.busfix.main.repair.ContentFragment;
import com.tepth.busfix.main.repair.HistoryFragment;


/**
 * Created by YoKeyword on 16/6/5.
 */
public class FragmentAdapter extends FragmentPagerAdapter {
    private String[] mTab = new String[]{"维修作业", "维保历史"};
    private ContentFragment mContentFragment;
    private HistoryFragment mHistoryFragment;

    public FragmentAdapter(FragmentManager fm,
                           ContentFragment contentFragment,
                           HistoryFragment historyFragment) {
        super(fm);
        mContentFragment = contentFragment;
        mHistoryFragment = historyFragment;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            return mContentFragment;
        } else {
            return mHistoryFragment;
        }
    }

    @Override
    public int getCount() {
        return mTab.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTab[position];
    }
}
